% Database Server
host = '173.194.106.119';

% Database Username/Password
% user = 'mnair';
% password = 'tsunami';

user = 'root';
password = 'iwtlnk';

% Database Name
dbName = 'geomag';

% JDBC Parameters
jdbcString = sprintf('jdbc:mysql://%s/%s', host, dbName);
jdbcDriver = 'com.mysql.jdbc.Driver';

% Set this to the path to your MySQL Connector/J JAR
javaaddpath('/Users/Shared/Java/mysql-connector-java-5.1.27/mysql-connector-java-5.1.27-bin.jar')

% Create the database connection object
dbConn = database(dbName, user , password, jdbcDriver, jdbcString);

% Check to make sure that we successfully connected
if isconnection(dbConn)
	% Fetch the symbol, market cap, and last close for the 10 largest
	% market cap ETFs
	result = get(fetch(exec(dbConn, 'SELECT * from DSTSplit')), 'Data');
	disp(result);
else
	% If the connection failed, print the error message
	disp(sprintf('Connection failed:&nbsp;%s', dbConn.Message));
end

% Close the connection so we don't run out of MySQL threads
close(dbConn);